#include "stdafx.h"
#include "HBCurlThreadPool.h"
#include "HBCurl.h"


CHBCurlThradPool::CHBCurlThradPool(void)
{
}

CHBCurlThradPool::~CHBCurlThradPool(void)
{
}

CHBCurlThradPool& CHBCurlThradPool::Instance()
{
	static CHBCurlThradPool threadPool;
	return threadPool;
}
//////////////////////////////////////////////////////////////////////////
CHBDownLoadThreadWorkor::CHBDownLoadThreadWorkor( const QString& sUrl, const QString& sLocalPath, qint64 iStartPos, qint64 iEndPos, 
	qint64 iFileSize, const QString& sUserPwd, bool bPreCreateFile /*= true*/ )
	: m_sUrl(sUrl)
	, m_sLocalPath(sLocalPath)
	, m_iStartPos(iStartPos)
	, m_iEndPos(iEndPos)
	, m_iFileSize(iFileSize)
	, m_sUserPwd(sUserPwd)
	, m_bPreCreateFile(bPreCreateFile)
{
}

void CHBDownLoadThreadWorkor::run()
{
	CHBEasyCurl::DownloadFile(m_sUrl, m_sLocalPath, m_sUserPwd, m_iStartPos, m_iEndPos, 
		m_iFileSize, m_bPreCreateFile, true);
}
///
CHBFtpUpLoadThreadWorkor::CHBFtpUpLoadThreadWorkor( const QString& sUrl, const QString& sLocalPath, const QString& sUserPwd )
	: m_sUrl(sUrl)
	, m_sLocalPath(sLocalPath)
	, m_sUserPwd(sUserPwd)
{

}

void CHBFtpUpLoadThreadWorkor::run()
{
	CHBEasyCurl::UploadFile(m_sUrl, m_sLocalPath, m_sUserPwd, true);
}